Namespace - LJCNetCommon
Parameters
type - The object type.
data - The object reference.
namespaces - The XML namespaces.
fileSpec - The output file spec.
rootName - The Root Name value.
Syntax
C# |
public static Void XmlSerialize(Type type, Object data, XmlSerializerNamespaces namespaces, String fileSpec, String rootName = null)
|
Serialize an object to an XML message file. (E)
Example
C# |
using LJCNetCommon
public class Person
{
public long Id { get; set; }
public string Name { get; set; }
public bool PrincipleFlag { get; set; }
}
private static void XmlSerialize()
{
var person = new Person()
{
Id = 2,
Name = "Text",
PrincipleFlag = true
};
string file = "Text.xml";
NetCommon.XmlSerialize(person.GetType(), person, null, file);
Person newPerson;
newPerson = NetCommon.XmlDeserialize(typeof(Person), file) as Person;
}
|
Copyright © Lester J. Clark and Contributors.
Licensed under the MIT License.